﻿using UnityEngine;
using System.Collections;
using System.Collections.Generic;
/// <summary>
/// 游戏类 管理所有游戏相关 永远存在 不会被销毁
/// </summary>
public class Game : MonoBehaviour
{
    public static ModelManager Model;
    public static NetManager Net;
    public static UIManager UI;
    public static SceneManager Scene;
    public static PacketHelper Packet;
    public static EventManager Event;
	public static BattleManager Battle;

	

    public static string ConfigPath()
    {
        return Application.dataPath + "/../../Public/GameTable";
    }
    void Awake() 
    {
        GameObject.DontDestroyOnLoad(gameObject);
        Init();
    }

    public void Init() 
    {
        Packet = new PacketHelper();
        Scene = new SceneManager();
        Model = new ModelManager();
        Net = new NetManager();
        UI = new UIManager(); 
		Battle = new BattleManager();
		Battle.Init();
        Event = new EventManager();     
        OnLoad();
    }


    void Update()
    {
        if (Game.Net!=null&&Game.Net.NetWork != null)
        {
            Game.Net.NetWork.Update();
        }
        if (Game.Scene.CurScene != null) 
        {
            Game.Scene.CurScene.OnUpdate();
        }
    }

    protected virtual void OnLoad()
    {
    
    }
   

}
  